package com.xdf.xzymanagementsystem.controller;

import com.xdf.xzymanagementsystem.dto.GridConfigDTO;
import com.xdf.xzymanagementsystem.entity.ResponseResult;
import com.xdf.xzymanagementsystem.enums.ResponseEnum;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
import com.xdf.xzymanagementsystem.service.SysUserTablePageConfigService;

/**
 * @Description : 前端网格配置表
 * @Author : 张柯
 * @Date : 2021-07-29 15:01:03
 */
@Api(tags = "前端网格配置表")
@CrossOrigin
@RestController
@RequestMapping("/sysUserTablePageConfig")
public class SysUserTablePageConfigController {
    @Autowired
    private SysUserTablePageConfigService service;

    /**
     * 查询方法
     *
     * @param record
     * @return
     * @throws Exception
     */
    @ApiOperation(value = "查询方法", httpMethod = "POST", notes = "自动生成的查询方法")
    @RequestMapping(value = "/calculate", method = RequestMethod.POST)
    public Map<String, GridConfigDTO> calculate(@RequestBody List<GridConfigDTO> record) throws Exception {
        return service.calculate(record);
    }

    /**
     * 修改配置
     *
     * @param record
     * @return
     * @throws Exception
     */
    @ApiOperation(value = "修改方法", httpMethod = "POST", notes = "修改方法")
    @RequestMapping(value = "/modify/config", method = RequestMethod.POST)
    public ResponseResult<Void> gridConfigModify(GridConfigDTO record) throws Exception {
        service.updateByParam(record);
        return ResponseResult.<Void>builder().success(true).message(ResponseEnum.OK.getName()).build();
    }
}